package com.hf.security

class OrderUserService {

	List<OrderUser> getAvailableUserList() {
		List<OrderUser> orderUserList = OrderUser.findAll(""" \
		from OrderUser u \
		where u.isOrderFrequent = true \
		""")

		return orderUserList
	}

	List<OrderUser> getOweMoneyUserNotPaid() {
		List<OrderUser> orderUserList = OrderUser.findAll(""" \
			from OrderUser user where user.isPaid = false and user.oweMoney != 0 \
		""")

		return orderUserList
	}

	void updateIsPaidFalse() {
		OrderUser.executeUpdate("update OrderUser user set user.isPaid = false");
	}
}
